{__NOLAYOUT__}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" type="text/css" href="/agent/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="/agent/css/tianxie_dingdan.css"/>
    <link rel="stylesheet" type="text/css" href="/agent/css/my_dingdan.css"/>
    <link rel="stylesheet" type="text/css" href="/agent/css/user.css"/>
    <script type="text/javascript" src="/agent/js/jquery.1.9.1.js"></script>
    <script type="text/javascript" src="/agent/js/rem.js"></script>
    <script type="text/javascript" src="/agent/js/layer.js" ></script>
    <link rel="stylesheet" href="/agent/css/layer.css" />
    <script type="text/javascript" src="/agent/js/honeySwitch.js" ></script>
    <link rel="stylesheet" href="/agent/css/honeySwitch.css" />
    <title>填写订单</title>
</head>
<body>
<!--我的收货地址-->
<script>
  $(document).ready(function(){
    var myHeight = $(window).height();
    $(".address_mask").css('height',myHeight);
//  $(".myaddress").css('height',myHeight/2.5);
    $('.shouhuo_info').click(function(){
      $('.address_mask').show();
    });
    $('.address_close').click(function(){
      $('.address_mask').hide();
    });
    $('.delete').click(function(){
        var id = $(this).attr('data-id');
        $.ajax({
          type:'post',
          url:'/agent/agent/delAddress',
          data:{id:id},
          success:function (data) {
            if(data.code == 1)
            {
              $('.del_'+data.data).remove();
            }
          }
        });
    });
    //设置收货地址
    $('.add_l').click(function () {
      var id = $(this).attr('data-id');
      $.ajax({
        type:'post',
        url:'/agent/agent/upAddress',
        data:{id:id},
        success:function (data) {
          if(data.code != 1){}
        }
      });
    });
    //选中当前收货地址
    $('.selectedAddress').click(function () {
      var id = $(this).attr('data-id');
      var name = $(this).attr('data-name');
      var tel = $(this).attr('data-tel');
      var address = $(this).attr('data-address');
      $('#addressName').text('收货人：'+name+'\n'+tel);
      $('#addressAddress').text('收货地址：：'+address);
      $('#WarehouseId').val(id);
      var html = '<div class="name" id="addressName">\n' +
        '                收货人：'+name+' &nbsp;&nbsp;&nbsp;\n' +
        '                '+tel+'\n' +
        '            </div>\n' +
        '            <input type="hidden" id="WarehouseId" name="WarehouseId" value="'+id+'">\n' +
        '            <div class="address">\n' +
        '                <img class="dizhi" src="/agent/img/address.png"/>\n' +
        '                <img class="jiantou" src="/agent/img/you.png"/>\n' +
        '                <p id="addressAddress">\n' +
        '                    收货地址：'+address+'</p>\n' +
        '            </div>\n' +
        '            <img style="width: 108%;margin-left: -0.3rem;margin-top: 0.2rem;" src="/agent/img/h.jpg"/>';
      $('.shouhuo_info').html(html);
      $('.address_mask').hide();
    });
  });
</script>

<div class="address_mask">
    <div class="myaddress" style="height: 5.5rem;">
    		<div style="position: fixed;bottom: 4.6; background: #fff;">
    			<h2>我的地址</h2>
	        <img style="width: 100%;" src="/agent/img/h.jpg"/>
	        <img class="address_close" src="/agent/img/cha.png"/>
    		</div>
	        
        <div id="tbh5v0">
            <div class="address_top"></div>
            {if $WarehouseList}
                {volist name="WarehouseList" id="data"}
                    <div class="address_add del_{$data.id}">
                        <dl class="selectedAddress" data-id="{$data.id}" data-name="{$data.name}" data-tel="{$data.tel}" data-address="{$data.province_text}{$data.city_text}{$data.area_text}{$data.address}">
                            <dt>
                                <strong>&nbsp;{$data.name}</strong>
                                <span>{$data.tel}</span>
                            </dt>
                            <dd>{$data.province_text}{$data.city_text}{$data.area_text}{$data.address}</dd>
                        </dl>
                        <div class="address_bottom">
                            <div class="add_l" data-id="{$data.id}">
                                <input type="radio" name="checkradio" {$data.status == 1 ? 'checked' : ''} value="" />
                                <em>设为默认地址</em>
                            </div>
                            <div class="add_r" >
                                <a href="/agent/agent/editAddress/id/{$data.id}"><span>编辑</span></a>
                                <a class="delete" data-id="{$data.id}" href="javascript:void(0);" onclick="if (confirm('你确认要删除该收货地址吗？')) location.href='#'"><em>删除</em></a>
                            </div>
                        </div>
                    </div>
                {/volist}
            {/if}

        </div>

        <div style=" width:100%; height:50px;"></div>
        <div class="list_footer">
            <a href="/agent/agent/addAddress?url={$Request.root}{$Request.url}">添加新地址</a>
        </div>
    </div>
</div>
<form id="" action="/agent/shopping/productionOrdes" method="post">
    <div class="shouhuo_info">
        {if $defaultAddress}
        <!--收货信息-->
            <div class="name" id="addressName">
                收货人：{$defaultAddress.name}&nbsp;&nbsp;&nbsp;
                {$defaultAddress.tel}
            </div>
            <input type="hidden" id="WarehouseId" name="githouse_id" value="{$defaultAddress.id}">
            <div class="address">
                <img class="dizhi" src="/agent/img/address.png"/>
                <img class="jiantou" src="/agent/img/you.png"/>
                <p id="addressAddress">
                    收货地址：{$defaultAddress.province_text}{$defaultAddress.city_text}{$defaultAddress.area_text}{$defaultAddress.address}</p>
            </div>
            <img style="width: 108%;margin-left: -0.3rem;margin-top: 0.2rem;" src="/agent/img/h.jpg"/>
        {else}
            请添加收货地址<img style="width: 0.3rem;float: right;" src="/agent/img/you.png"/>
            <img style="width: 108%;margin-left: -0.3rem;margin-top: 0.2rem;" src="/agent/img/h.jpg"/>
            <input type="hidden" id="AddWarehouseId" value="123">
        {/if}
    </div>
    <!--订单列表-->
    <div class="dingdan_list">
        {volist name="list" id="data"}
        <ul class="single_item info">
            <div class="order_list">
                <a href="#">
                    <div class="order_list_goods">
                        <dl>
                            <dt>
                                <img src="{:imgno($data.image)}">
                            </dt>
                            <dd class="name">
                                <strong>{$data.cname}</strong>
                            </dd>
                            <input type="hidden" name="sid[]" value="{$data.sid}">
                            <dd class="pice">{$data.price}<em>x{$data.number}</em></dd>
                        </dl>
                    </div>
                </a>

            </div>
        </ul>
        {/volist}
    </div>
     <div class="fapiao">
       
        <ul class="fa_info" id="network" style="display: block;">
            <li>
                <input type="text" name="receivingWay"  value="" placeholder="物流方式"/>
            </li>
             <li>
                <input type="text" name="freightFor"  value="" placeholder="运费承担"/>
            </li>
            <li>
                <input  type="text" name="forArrivalGoodsTime"  value="" placeholder="到货时间">
            </li>
        </ul>
    </div>
    <!--发票
    <div class="fapiao">-->
        <!--<img src="/agent/img/you.png"/>
        <span>填写发票信息</span>
        <div class="common-row">
			<div class="cell-left">发票</div>
			<div class="cell-right"><span class="switch-off" themeColor="#34bc48" id="fly"></span></div>
		</div>
		<ul class="fa_info" id="network">
            <li>
                <input type="text" name="company" disabled value="{$auth->finance_invoice}" placeholder="请填写单位名称"/>
            </li>
            <li>
                <input type="number" name="ein" disabled value="{$auth->finance_taxnumber}" placeholder="请填写纳税人识别号"/>
            </li>
        </ul>-
    </div>->
    <!--<div class="fa_mask">
        <div class="fa_info">
            <img class="fa_close" src="/agent/img/cha.png"/>
            <h2>发票</h2>
            <p>发票抬头</p>
            <ul>
                <li>
                    <input type="text" name="company"  value="" placeholder="请填写单位名称"/>
                </li>
                <li>
                    <input type="number" name="ein"  value="" placeholder="请填写纳税人识别号"/>
                </li>
            </ul>
            <a href="#">
                <div class="button" onclick="$('.fa_mask').hide();">确定</div>
            </a>
        </div>
    </div>-->
    <!--备注-->
    <div class="beizhu">
        备注
        <div style="padding: 0.25rem;">
            <textarea name="remark"  placeholder="请输入…"></textarea>
        </div>
    </div>
    <!--提交订单-->
    <div class="submit">
        <input type="submit" value="提交订单"/>
       <!--  <span>
            合计：<span style="color: #f3494c;">￥{$total}</span>
        </span> -->
    </div>
</form>
<script>
  $(document).ready(function () {
//	    var myHeight = $(window).height();
//	    $(".fa_mask").css('height', myHeight);
	    $('.fapiao').click(function () {
	      $('.fa_info').show();
//	      $('input[type="submit"]').attr("disabled","disabled");
	    });
//	    $('.fa_close').click(function () {
//	      $('.fa_mask').hide();
//	      $('input[type="submit"]').attr("disabled",false);
//	    });
	    var address = $('#AddWarehouseId').val();
	    $('.submit').click(function () {
	      if(address == '123'){
	      	layer.open({
				content: '收货地址不能为空',
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false;
	      }
	    });
  });
</script>
</body>
<script>
	$(function(){
		switchEvent("#fly",function(){
			$("#network").slideDown();//开
			$("input[name='company']").attr('disabled',false);
			$("input[name='ein']").attr('disabled',false);
		},function(){
			$("#network").slideUp();//关
			$("input[name='company']").attr('disabled',true);
			$("input[name='ein']").attr('disabled',true);
		});
	});
</script>
</html>
